package com.doraro.codegen;

import com.baomidou.mybatisplus.generator.AutoGenerator;

/**
 * <p>
 * Mysql代码生成器
 * </p>
 */
public class MysqlGenerator extends SuperGenerator {


    public static final String OUTPUT_DIR = getProjectJavaPath();
    static final String PACKAGE_BASE_NAME = "com.doraro.coal.moudle.annoc";
    static final String MYSQL5_DRIVER = "com.mysql.cj.jdbc.Driver";
    static final String PASSWORD = "root";
    static final String USERNAME = "root";
    static final String DB_URL = "jdbc:mysql://127.0.0.1:3306/coal?characterEncoding=utf8&useSSL=false";
    static final String TABLE_PREFIX = "t_";

    private final Boolean ENTITY_ONLY = false;

    public static void main(String[] args) {
        final MysqlGenerator mysqlGenerator = new MysqlGenerator();
        mysqlGenerator.generator("t_annoc");
    }

    public void generator(String tableName) {
        // 代码生成器
        AutoGenerator mpg = getAutoGenerator(tableName, ENTITY_ONLY);
        mpg.execute();
        if (tableName == null) {
            System.err.println(" Generator Success !");
        } else {
            System.err.println(" TableName【 " + tableName + " 】" + "Generator Success !");

        }
    }

}
